package com.kang.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebFlux;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;

@Configuration
@EnableSwagger2WebMvc
@EnableSwagger2WebFlux
public class knife4jConfig {

    @Bean(value = "defaultApi2")
    public Docket defaultApi2() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(new ApiInfoBuilder()
                        .title("my knife4j api")
                        .description("my restful api")
                        .termsOfServiceUrl("www.baidu.com")
                        .contact(new Contact("kangkang", "www.baidu.com", "1961338673@qq.com"))
                        .version("1.0")
                        .build())
                .groupName("group 1.0")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.kang.controller"))
                .paths(PathSelectors.regex("/user/.*"))
                .build();
    }


}
